package com.zbkj.crmeb.store.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.common.CommonPage;
import com.common.PageParamRequest;
import com.crmeb.core.common.CommonResult;
import com.github.pagehelper.PageInfo;
import com.zbkj.crmeb.store.model.CustomsRecord;
import com.zbkj.crmeb.store.model.ExhibitApplication;
import com.zbkj.crmeb.store.request.CustomsRecordSearchRequest;
import com.zbkj.crmeb.store.request.ExhibitApplicationSearchRequest;
import com.zbkj.crmeb.store.response.CustomsRecordResponse;
import com.zbkj.crmeb.store.response.ExhibitApplicationResponse;
import com.zbkj.crmeb.store.service.CustomsRecordService;
import com.zbkj.crmeb.store.service.ExhibitApplicationService;

/**
 * 展会报名表 前端控制器
 *
 */
@RestController
@RequestMapping("api/admin/store/exhibit/application")
public class ExhibitApplicationController {
    @Autowired
    private ExhibitApplicationService exhibitApplicationService;

    /**
     * 分页显示展会报名表
     *
     * @param request          搜索条件
     * @param pageParamRequest 分页参数
     */
    @ApiOperation(value = "展会报名分页列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<ExhibitApplicationResponse>> getRecordList(@Validated ExhibitApplicationSearchRequest request, @Validated PageParamRequest pageParamRequest) {

        PageInfo<ExhibitApplicationResponse> pageInfo = exhibitApplicationService.getList(request, pageParamRequest);
        return CommonResult.success(CommonPage.restPage(pageInfo));
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("/delete/{id}")
    public CommonResult<String> delete(@PathVariable Integer id) {
        return exhibitApplicationService.removeById(id) ? CommonResult.success() : CommonResult.failed();
    }

}
